import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export const routes = [
  {
    path: '/',
    redirect: '/dashboard',
  },
  {
    path: '/',
    component: () => import(/* webpackChunkName: "home" */ '@/views/common/Home'),
    meta: { title: '自述文件' },
    children: [
      {
        path: '/dashboard',
        component: () => import(/* webpackChunkName: "dashboard" */ '@/views/Dashboard'),
        meta: { title: '系统首页', icon: 'el-icon-lx-home' },
      },
      {
        path: '/myshop',
        component: () => import(/* webpackChunkName: "shop" */ '@/views/MyShop'),
        meta: { title: '我的店铺', icon: 'el-icon-lx-shop' },
        redirect: '/myshop/exhibit',
        children: [
          {
            path: '/myshop/exhibit',
            name: 'myshop-exhibit',
            component: () => import(/* webpackChunkName: "myshop-exhibit" */ '@/views/MyShop/components/Exhibit'),
            meta: { title: '我的店铺' },
          },
          {
            path: '/myshop/editing',
            name: 'myshop-editing',
            component: () => import(/* webpackChunkName: "myshop-editing" */ '@/views/MyShop/components/Editing'),
            meta: { title: '我的店铺-编辑' },
          },
        ],
      },
      {
        path: '/message',
        component: () => import(/* webpackChunkName: "cessage" */ '@/views/Message'),
        meta: { title: '消息', icon: 'el-icon-bell' },
      },
      {
        path: '/goods',
        component: () => import(/* webpackChunkName: "goods" */ '@/views/Goods'),
        meta: { title: '商品管理', icon: 'el-icon-lx-goods', power: 'goods' },
        redirect: '/goods/exhibit',
        children: [
          {
            path: '/goods/exhibit',
            name: 'goods-exhibit',
            component: () => import(/* webpackChunkName: "goods-exhibit" */ '@/views/Goods/components/Exhibit'),
            meta: { title: '商品管理-展示' },
          },
          {
            path: '/goods/editing/:id',
            name: 'goods-editing',
            component: () => import(/* webpackChunkName: "goods-editing" */ '@/views/Goods/components/Editing'),
            meta: { title: '商品管理-编辑' },
          },
        ],
      },
      {
        path: '/brand',
        component: () => import(/* webpackChunkName: "brand" */ '@/views/Brand'),
        meta: { title: '品牌管理', icon: 'el-icon-lx-favorfill', power: 'brand' },
        redirect: '/brand/exhibit',
        children: [
          {
            path: '/brand/exhibit',
            name: 'brand-exhibit',
            component: () => import(/* webpackChunkName: "brand-exhibit" */ '@/views/Brand/components/Exhibit'),
            meta: { title: '品牌管理-展示' },
          },
          {
            path: '/brand/editing/:id',
            name: 'brand-editing',
            component: () => import(/* webpackChunkName: "brand-editing" */ '@/views/Brand/components/Editing'),
            meta: { title: '品牌管理-编辑' },
          },
        ],
      },
      {
        path: '/classify',
        component: () => import(/* webpackChunkName: "classify" */ '@/views/Classify'),
        meta: { title: '分类管理', icon: 'el-icon-lx-sort', power: 'classify' },
      },
      {
        path: '/user',
        component: () => import(/* webpackChunkName: "brand" */ '@/views/User'),
        meta: { title: '用户管理', icon: 'el-icon-user', power: 'user' },
        redirect: '/user/exhibit',
        children: [
          {
            path: '/user/exhibit',
            name: 'user-exhibit',
            component: () => import(/* webpackChunkName: "user-exhibit" */ '@/views/User/components/Exhibit'),
            meta: { title: '用户管理-展示' },
          },
          {
            path: '/user/editing/:id',
            name: 'user-editing',
            component: () => import(/* webpackChunkName: "user-editing" */ '@/views/User/components/Editing'),
            meta: { title: '用户管理-编辑' },
          },
        ],
      },
      // {
      //   path: '/icon',
      //   component: () => import(/* webpackChunkName: "icon" */ '@/views/Icon'),
      //   meta: { title: '自定义图标' },
      // },
      // {
      //   // 权限页面
      //   path: '/permission',
      //   component: () => import(/* webpackChunkName: "permission" */ '@/views/Permission'),
      //   meta: { title: '权限测试', permission: true },
      // },
      {
        path: '/404',
        component: () => import(/* webpackChunkName: "404" */ '@/views/404'),
        meta: {},
      },
      {
        path: '/403',
        component: () => import(/* webpackChunkName: "403" */ '@/views/403'),
        meta: {},
      },
    ],
  },
  {
    path: '/login',
    component: () => import(/* webpackChunkName: "login" */ '@/views/Login'),
    meta: { title: '登录' },
  },
  {
    path: '*',
    redirect: '/404',
  },
]

export default new Router({
  routes,
})
